package org.jianfa.learn.jpa.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/")
public class LoginController {

    @PostMapping("login")
    public String login(HttpServletRequest httpServletRequest) {
        Boolean login = (Boolean) httpServletRequest.getAttribute("login");
        if (login) {
            return "redirect:resumes";
        }

        return "redirect:/";
    }

    @PostMapping("logout")
    public String logout() {
        return "redirect:/";
    }

}
